package util.ourIterator;

/**
 * Created by mahanlei on 2016/11/24.
 */
public class ConcreteIterator implements  Iterator {
    private List list = null;
    private int index;

             public ConcreteIterator(List list) {

                 this.list = list;
             }

     public boolean hasNext() {
                 if (index >= list.getSize()) {
                        return false;
                     } else {
                        return true;
                    }
             }


     public Object next() {
                Object object = list.get(index);
                 index++;
               return object;
            }
}
